﻿<phoneNavigation:PhoneApplicationPage 
    x:Class="Windows_Phone_Audio_Recorder.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phoneNavigation="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Navigation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}">

    <phoneNavigation:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="template">
            <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
                <Rectangle Height="{Binding}" Width="5" Fill="Blue" />
                <Rectangle Width="2" />
            </StackPanel>
        </DataTemplate>
    </phoneNavigation:PhoneApplicationPage.Resources>
    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitleGrid is the name of the application and page title-->
        <Grid x:Name="TitleGrid" Grid.Row="0">
            <TextBlock Text="MY APPLICATION" x:Name="textBlockPageTitle" Style="{StaticResource PhoneTextPageTitle1Style}"/>
            <TextBlock Text="Audio recorder" x:Name="textBlockListTitle" Style="{StaticResource PhoneTextPageTitle2Style}"/>
        </Grid>

        <!--ContentGrid is empty. Place new content here-->
        <Grid x:Name="ContentGrid" Grid.Row="1">           
            <ItemsControl x:Name="icBar" ItemsSource="{Binding Path=AudioData}" 
			    ItemTemplate="{StaticResource template}" Margin="0,6,0,114">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
            
            <Button Click="btnStart_Click" x:Name="btnStart" Content="Start" Height="70" HorizontalAlignment="Left" Margin="0,620,0,0" VerticalAlignment="Top" Width="160" />
            <Button Click="btnStop_Click" x:Name="btnStop" Content="Stop" Height="70" HorizontalAlignment="Left" Margin="157,620,0,0"  VerticalAlignment="Top" Width="160" />
            <Button Click="btnPlay_Click" x:Name="btnPlay" Content="Play" Height="70" HorizontalAlignment="Left" Margin="314,620,0,0" VerticalAlignment="Top" Width="160" />
            <TextBlock Height="23" HorizontalAlignment="Left" Margin="109,590,0,0" Name="tbData" Text="00:00:00" VerticalAlignment="Top" />
            <TextBlock Height="23" HorizontalAlignment="Left" Margin="20,590,0,0" Name="textBlock1" Text="Duration:" VerticalAlignment="Top" />
            <Popup x:Name="ProgressPopup" Width="300" IsOpen="False" HorizontalAlignment="Center" VerticalAlignment="Top" d:LayoutOverrides="Width, HorizontalMargin" Margin="91,146,89,0">
                <Border BorderThickness="10" BorderBrush="DarkGray" Background="{StaticResource PhoneBackgroundBrush}" Padding="30,30">
                    <StackPanel>
                        <TextBlock Text="Enter name of audio file"></TextBlock>
                        <TextBox x:Name="txtAudio"></TextBox>
                        <Button Content="Save" Click="btnSave_Click" x:Name="btnSave"></Button>
                    </StackPanel>
                </Border>
            </Popup>
        </Grid>
    </Grid>
    
</phoneNavigation:PhoneApplicationPage>